home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / tektronix.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  2KB  |  89 lines

  1. /* This file contains the tektronix dependent routines for use with plplot. */
  2.  
  3. /* Define graphics control characters. */
  4. #define BS    8
  5. #define HT    9
  6. #define LF   10
  7. #define VT   11
  8. #define FF   12
  9. #define CR   13
  10. #define CAN  24
  11. #define EM   25
  12. #define ESC  27
  13. #define FS   28
  14. #define GS   29
  15. #define US   31
  16.  
  17. #include <stdio.h>
  18. #include "plplot.h"
  19.  
  20. static FILE *OutFile;
  21. static int FirstClear=1;
  22.  
  23. /* Open file. */
  24. void tekini()
  25. {
  26.       char FileName[80];
  27.  
  28.       printf("Enter file to receive tektronix graphics commands. ");
  29.       scanf("%s",FileName);
  30.  
  31.       if ((OutFile = fopen(FileName,"w")) == NULL)  {
  32.           printf("Error opening %s \n",FileName);
  33.           exit(1);
  34.       }
  35. }
  36.  
  37. /* Sets the tektronix to text mode */
  38. void tektex()
  39. {
  40.     fprintf(OutFile,"%c",US);
  41. }
  42.  
  43. /* Sets the tektronix to graphics mode */
  44. void tekgra()
  45. {
  46.     /* Nothing has to be done here */
  47. }
  48.  
  49. /* Clears the tektronix screen */
  50. void tekclr()
  51. {
  52.       if(FirstClear) 
  53.         FirstClear = 0;
  54.       else
  55.         fprintf(OutFile,"%c%c",ESC,FF);
  56. }
  57.  
  58. /* Change color */
  59. void tekcol(colour)
  60. int colour;
  61. {
  62. }
  63.  
  64. /* Draws a line in the current colour from (x1,y1) to (x2,y2) */
  65. void teklin(x1,y1,x2,y2)
  66. int x1,y1,x2,y2;
  67. {
  68.     int hy,ly,hx,lx;
  69.  
  70.     fprintf(OutFile,"%c",GS);
  71.     hy = y1/32 + 32;
  72.     ly = y1 - (y1/32)*32 + 96;
  73.     hx = x1/32 + 32;
  74.     lx = x1 - (x1/32)*32 + 64;
  75.     fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
  76.     hy = y2/32 + 32;
  77.     ly = y2 - (y2/32)*32 + 96;
  78.     hx = x2/32 + 32;
  79.     lx = x2 - (x2/32)*32 + 64;
  80.     fprintf(OutFile,"%c%c%c%c",hy,ly,hx,lx);
  81. }
  82.  
  83. /* Close file */
  84. void tektid()
  85. {
  86.    fclose(OutFile);
  87. }
  88.  
  89.